home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Games #12
/
GEGA012.iso
/
Jogos de Azar
/
1721-apuesten.swf
/
scripts
/
C_GamesOpenMenuCLASS.as
< prev
next >
Wrap
Text File
|
2006-01-17
|
5KB
|
171 lines
_global.C_GamesOpenMenuCLASS = function()
{
this.init();
};
C_GamesOpenMenuCLASS.prototype = new MovieClip();
C_GamesOpenMenuCLASS.prototype.init = function()
{
var o = this.attachMovie("GameMenu:holder","holder_mc",1);
o._x = -39;
o._y = 10;
o._visible = false;
var tf1 = this.holder_mc.text_mc;
var tf2 = this.holder_mc.title_mc;
o = this.textFormats = {};
o.game = tf1.text_txt.getTextFormat();
o.game_over = tf1.text_txt.getTextFormat();
o.game_over.underline = true;
o.title = tf2.text_txt.getTextFormat();
tf1.removeMovieClip();
tf2.removeMovieClip();
this.loadMenu();
this.openGames_btn.root = this;
this.openGames_btn.onRelease = function()
{
this.root.open();
};
};
C_GamesOpenMenuCLASS.prototype.loadMenu = function()
{
var x = new XML();
x.root = this;
x.ignoreWhite = true;
x.onLoad = function(s)
{
if(!s)
{
trace("меню не загрузилось!");
return undefined;
}
this.root.createMenu(this);
};
x.load(this.configPath);
};
C_GamesOpenMenuCLASS.prototype.createMenu = function(x)
{
this.inited = true;
var a = x.firstChild.childNodes;
var menu_items = [];
var o;
var item;
var h = this.holder_mc;
var height;
h.space_mc._visible = false;
h.title_mc._visible = false;
h.text_mc._visible = false;
var i = 0;
while(i < a.length)
{
o = a[i].attributes;
if(o.type == "spacer")
{
item = h.attachMovie("GameMenu:spacer","spacer_" + i,i);
}
else if(o.type == "title")
{
item = h.attachMovie("GameMenu:titleText","title_" + i,i);
item.text_txt.text = o.text;
}
else
{
item = h.attachMovie("GameMenu:gameText","text_" + i,i);
item.text_txt.text = o.text;
if(o.url != "" && o.url != undefined)
{
item.url = o.url;
item.target = o.target;
item.onRelease = function()
{
getURL(this.url,this.target);
this.clear();
this._parent._parent.close();
};
item.onRollOver = function()
{
var tf = new TextFormat();
tf.underline = true;
this.text_txt.setTextFormat(tf);
this.box_mc.gotoAndStop(2);
};
item.onRollOut = function()
{
this.box_mc.gotoAndStop(1);
this.clear();
};
item.clear = function()
{
var tf = new TextFormat();
tf.underline = false;
this.text_txt.setTextFormat(tf);
};
}
else
{
var tf = new TextFormat();
tf.color = 10066329;
item.text_txt.setTextFormat(tf);
}
}
menu_items.push(item);
height += item._height;
i++;
}
a = menu_items;
height -= h.space_mc._y;
var nextY = a[0]._y -= height;
nextY += a[0]._height;
var d_y = h.top_mc._y;
h.top_mc._y = a[0]._y - h.top_mc._height - 14;
d_y -= h.top_mc._y;
h.middle_mc._y -= d_y;
h.middle_mc._height += d_y;
var i = 1;
while(i < a.length)
{
a[i]._y = nextY;
nextY += a[i]._height;
i++;
}
this.top_mc.onRelease = this.middle_mc.onRelease = this.bottom_mc.onRelease = function()
{
};
this.top_mc.useHandCursor = this.middle_mc.useHandCursor = this.bottom_mc.useHandCursor = false;
};
C_GamesOpenMenuCLASS.prototype.open = function()
{
if(!this.inited)
{
return undefined;
}
var o = this.holder_mc;
o._visible = true;
if(_root._xscale != 100)
{
var s_index = 100 / _root._xscale;
o._xscale = 100 * s_index;
o._yscale = 100 * s_index;
}
o = this.listener = {};
o.root = this;
o.onMouseDown = function()
{
if(!this.root.hitTest(_root._xmouse,_root._ymouse,false))
{
this.root.close();
}
};
o.onKeyDown = function()
{
this.root.close();
};
Mouse.addListener(o);
Key.addListener(o);
};
C_GamesOpenMenuCLASS.prototype.close = function()
{
this.removeListener(this.listener);
this.holder_mc._visible = false;
};
Object.registerClass("C_GamesOpenMenuCLASS",C_GamesOpenMenuCLASS);
delete _global.C_GamesOpenMenuCLASS;